/*************************************************************************
	> File Name: 008.P1164.小A点菜.cpp
	> Author: Maureen 
	> Mail: Maureen@qq.com 
	> Created Time: 二  6/29 14:45:59 2021
 ************************************************************************/

#include <iostream>
using namespace std;

// 0/1背包问题

int n, m, a[105], ans[10005];

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    ans[0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = m; j >= a[i]; j--) {
            ans[j] = max(ans[j], ans[j - a[i]] + ans[j]); //在能买得起第i件物品时的方案总数为买和不买之和
        }
    }

    cout << ans[m] << endl;
    
    return 0;
}
